#include<bits/stdc++.h>
using namespace std;
int a[100001],n,wan=0;
int cha(int p) {
    int cnt=1;
    for(int i=p; i<=n; i++) {
        if(a[i]==a[i+1]&&a[i]!=-1)cnt++;
        else return cnt;
    }
    return cnt;
}
int main() {
    memset(a,-1,sizeof(a));
    cin>>n;
    int j=n;
    for(int i=1; i<=n; i++)cin>>a[i];
    while(j>=1){
    int o=0,q=0,s=0;
    while(s<=n&&a[s]!=-1&&a[o]!=-1){
    o++;
    cout<<wan+1<<" ";
    a[wan+1]=-1;
    q++;
     wan=cha(wan+1);
     s+=wan;
	}
    j-=q;
    cout<<endl;
    
	}
    }

